{% extends 'base.html' %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <h4 class="mb-0">用户注册</h4>
            </div>
            <div class="card-body">
                <form method="post">
                    {% csrf_token %}
                    {% for field in form %}
                    <div class="mb-3">
                        <label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
                        {{ field }}
                        {% if field.help_text %}
                        <small class="form-text text-muted">{{ field.help_text }}</small>
                        {% endif %}
                        {% for error in field.errors %}
                        <div class="invalid-feedback d-block">{{ error }}</div>
                        {% endfor %}
                    </div>
                    {% endfor %}
                    <button type="submit" class="btn btn-primary">注册</button>
                    <a href="{% url 'books:custom_login' %}" class="btn btn-link">已有账号？去登录</a>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}